<?php
 
class Cron
{
	function Cron()
	{
	}	

	function _print($sString, $bLog = false)
	{
		print $sString . "\n";
		
		if ( $bLog )
		{
			$oDb = &Database::get();
			
			$aQuery = array();
			$aQuery['cron_id'] = $this->aJob['cron_id'];
			$aQuery['time'] = time();
			$aQuery['info'] = $sString;
			$oDb->insert(App::getT('cron_log'), $aQuery);
		}
	}
	
	function _checkCron($sName)
	{
		$oDb = &Database::get();
		
		$aIsValid = $oDb->getRow("SELECT * FROM ". App::getT('cron_jobs') ." 
			WHERE file = '". $sName ."' AND active = '1'");
	
		if ( isset($aIsValid['cron_id']) )
		{
			$this->aJob = $aIsValid;
			return true;
		}
		
		return false;
	}
	
	function _execCron($sName)
	{
		require_once cronDir . "include/cron/jobs/". $sName .".php";
	}
}
 
 
?>